''' Mission 7 - Personal Billboard Medium Remix 2D This project creates a list with math facts. In order to print on multiple lines, display.print() must be used. However, it scrolls continuously, so the code for displaying was moved inside each button press to stop the scrolling. This isn't the only way to do it, but an option of students get frustrted. - It includes a button to break the loop and quit - ''' from codex import * from time import sleep choice = 0 my_list = ["Area of square: \n side x side", "Area of rectangle: \n length x width", "Area of circle: \n pi x radius x radius", "Area of right triangle: \n length x width / 2", "Perimeter of square: \n side x 4", "Perimeter of rect: \n length x 2 + width x 2", "Circumference: \n 2 x pi x radius", "Perim of triangle: \n side1 + side2 + side3"] LAST_INDEX = len(my_list) - 1 # MAIN PROGRAM while True: # display instructions display.clear() display.show("Press L/R to scroll") sleep(1) display.clear() # scroll backward and display item if buttons.was_pressed(BTN_L): choice = choice - 1 if choice < 0: choice = LAST_INDEX my_image = my_list[choice] display.print(my_image) sleep(2) # scroll forward and display item if buttons.was_pressed(BTN_R): choice = choice + 1 if choice > LAST_INDEX: choice = 0 my_image = my_list[choice] display.print(my_image) sleep(2) # break out of loop and quit if buttons.was_pressed(BTN_D): break